'use strict';

stareal
    .controller("WallletController", function ($scope, $api,$state,$alert,$lazyLoader) {
      $scope.myWalletStatus=1;
        var h=$(window).height()-1.6*parseFloat(document.documentElement.style.fontSize)+"px";
        $("#wrapper_container").height(h);
      $scope.switchMyWalletStatus=function(index){
          $scope.myWalletStatus=index;
          if(index==1){
              $scope.rechargeRecords= new $lazyLoader("app/getShowcoin/rechargeRecord", {},true);
              $scope.rechargeRecords.nextPage();
          }else{
              //消费记录 app/getShowcoin/exchangeRecord
              $scope.exchangeRecords=new $lazyLoader("app/getShowcoin/exchangeRecord", {},true);
              $scope.exchangeRecords.nextPage();
          }
      }
      $scope.switchMyWalletStatus(1);
 //当前钱包的数字app/showcoin/getShowcoin
        $api.get("app/getShowcoin/getShowcoin",{}, true)
            .then(function(ret){
               // console.log(ret);
                $scope.showWallet=ret.showcoin;
            });
        //app/showcoin/rechargeRecord

        // $api.get("app/showcoin/rechargeRecord",{}, true)
        //     .then(function(ret){
        //       // console.log(ret);
        //         $scope.rechargeRecords=ret.data;
        //     });
        $scope.goRechargewallet=function(){
            $state.go('main.rechargewallet',{})
        }
        $scope.copyToClipboard=function(txt) {
           // console.log(txt);
              //  var input = document.getElementById("walletCopyInput");
           //     input.value=txt; // 修改文本框的内容
            //console.log(document.getElementById("walletCopyInput").value);
            //    input.select(); // 选中文本
            //input.execCommand("Copy");
              // document.execCommand("copy"); // 执行浏览器复制命令
                $alert.show("复制订单号成功!");
        }

    });